﻿$(document).ready(Page_Load);

function Page_Load(e) {
    LoadNumberUsers();
}

function LoadNumberUsers() {
    $.ajax(
        {
            type: "POST",
            async: true,
            url: "Default.aspx/LoadUserStats",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: LoadUserStats_Success,
            error: LoadUserStats_Error
        });
    }

    function LoadUserStats_Success(data, textStatus, XMLHttpRequest) {
        var result = data.d;

        $('#number-users').html(result[0]);
        $('#number-active').html(result[1]);
    }

    function LoadUserStats_Error(XMLHttpRequest, textStatus, errorThrown) {
        Log(XMLHttpRequest, "LoadUserStats", 100);
        alert("An error occurred loading the user statistics. Error: " + XMLHttpRequest);

    }